const http=require('http');
var options={
    hostname:'www.baidu.com',
    port:80,
    methods:'GET',
    path:'/'
}

var req=http.request(options,(res)=>{
    console.log('Status:'+res.statusCode);
    console.log('Headers:');
    console.log(res.headers);
    res.setEncoding('utf-8');
    res.on('data',(chunk)=>{
        console.log(chunk);
    });
});
req.end();